/**
 * 
 */
package remato.domain.common.impl;

import java.util.HashSet;
import java.util.Set;

import remato.common.domain.impl.base.DomainName;
import remato.domain.common.UseCaseDefinition;
import remato.domain.common.UseCaseSystem;

/**
 * @author Petter L. H. Eide
 *
 */
public class UseCaseSystemImpl extends DomainName implements UseCaseSystem {

	private Set<UseCaseDefinition> useCaseDefinitions;
	private boolean hasChildren ;
	
	public UseCaseSystemImpl() {
		super();
		useCaseDefinitions = new HashSet<UseCaseDefinition>();
		hasChildren = false;
	}

	/* (non-Javadoc)
	 * @see remato.domain.common.UseCaseSystem#addUseCaseDefinition(remato.domain.common.UseCaseDefinition)
	 */
	public boolean addUseCaseDefinition(UseCaseDefinition useCaseDefinition) {
		return useCaseDefinitions.add(useCaseDefinition);
	}

	/* (non-Javadoc)
	 * @see remato.domain.common.UseCaseSystem#getUseCaseDefinitions()
	 */
	public Set<UseCaseDefinition> getUseCaseDefinitions() {
		return useCaseDefinitions;
	}

	/* (non-Javadoc)
	 * @see remato.domain.common.UseCaseSystem#removeUseCaseDefinition(remato.domain.common.UseCaseDefinition)
	 */
	public boolean removeUseCaseDefinition(UseCaseDefinition useCaseDefinition) {
		return useCaseDefinitions.remove(useCaseDefinition);
	}

	public void setUseCaseDefinitions(Set<UseCaseDefinition> useCaseDefinitions) {
		this.useCaseDefinitions = useCaseDefinitions;
		hasChildren = false;
	}

	public boolean hasChildren() {
		return hasChildren || ! useCaseDefinitions.isEmpty() ;
	}
	
	public void setHasChildren(boolean hasChildren) {
		this.hasChildren = hasChildren;
	}
}
